package com.evola.conditionalformatting
{

	/**
	 * Klasa definise cilj formatiranja.
	 * Sadrzi jedan konkretan cilj formatiranja.
	 * @author Sasa
	 *
	 */
	public class ViewGoalData
	{

		public var type:String;
		public var properties:Object;

		public function ViewGoalData()
		{
		}

		public function getPropertyValue(propName:String):String
		{
			var propValue:String;

			if (properties && properties.hasOwnProperty(propName))
				propValue=properties[propName];

			return propValue;
		}

		public function toExpressionString():String
		{

			var exp:String=type;

			if (properties)
			{

				var count:int=0;

				for (var propName:String in properties)
				{

					if (count == 0)
						exp+="(";

					if (count > 0)
						exp+=",";

					var propValue:String=properties[propName];

					exp+=propName + "=" + propValue;

					count++;
				}

				if (count > 0)
					exp+=")";
			}

			return exp;
		}

	}
}
